package com.program.cloudmanagesystem.hotel.persistence;

import com.program.cloudmanagesystem.hotel.domain.Human;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface HumanMapper {
    @Select("select * from human")
    List<Human> showHumen();
    @Select("select * from human where human.id = #{id}")
    Human searchHuman(String id);


    @Insert("insert into human(id,name,job ,base,birthday,onboard,sex,phone,hotelid) values (#{id},#{name},#{job},#{base},#{birthday},#{onboard},#{sex},#{phone},#{hotelid})")
    void insertHuman(@Param("id") String id,@Param("name") String name,@Param("job") String job,@Param("base") String base,@Param("birthday") String birthday,@Param("onboard") String onboard,@Param("sex") String sex,@Param("phone") String phone,@Param("hotelid") String hotelid);
    @Delete("delete from human where id = #{id}")
    void deleteHuman(String id);
    @Update("update human set name = #{name},job = #{job},base = #{base},birthday = #{birthday},onboard = #{onboard},sex = #{sex},phone = #{phone},hotelid = #{hotelid} where human.id = #{id}")
    void updateData(@Param("id") String id,@Param("name") String name,@Param("job") String job,@Param("base") String base,@Param("birthday") String birthday,@Param("onboard") String onboard,@Param("sex") String sex,@Param("phone") String phone,@Param("hotelid") String hotelid);

    @Select("select * from human where human.hotelid = #{hotelId}")
    List<Human> showHumenByHotelId(String hotelId);
}
